namespace Digitalmes.Common.Workflows;

/// <summary>
/// 工作流程。
/// </summary>
public sealed class Workflow
{
    public IReadOnlyDictionary<string, IReadOnlyCollection<WorkflowEdge>> Edges { get; }

    public Workflow(IList<WorkflowStep> steps, Dictionary<string, List<WorkflowEdge>> edges)
    {
        Edges = edges.ToDictionary(kvp => kvp.Key, kvp => (IReadOnlyCollection<WorkflowEdge>)kvp.Value.AsReadOnly());
    }

    /// <summary>
    /// 流程开始。
    /// </summary>
    /// <param name="e"></param>
    /// <param name="serviceProvider"></param>
    /// <returns></returns>
    public Task StartAsync(WorkflowEvent e, IServiceProvider? serviceProvider = null)
    {
        return Task.CompletedTask;
    }
}
